home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / db / esm-3.1 / esm-3 / usr / local / sm / src / include / OVPAGE.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-05  |  4.3 KB  |  145 lines

  1. #ifndef _OVPAGE_H_
  2. #define _OVPAGE_H_
  3. /*
  4.  * $RCSfile: OVPAGE.h,v $
  5.  * $Revision: 1.1.1.1 $
  6.  * $Date: 1996/05/04 21:55:07 $
  7.  */
  8. /**********************************************************************
  9. * EXODUS Database Toolkit Software
  10. * Copyright (c) 1991 Computer Sciences Department, University of
  11. *             Wisconsin -- Madison
  12. * All Rights Reserved.
  13. *
  14. * Permission to use, copy, modify and distribute this software and its
  15. * documentation is hereby granted, provided that both the copyright
  16. * notice and this permission notice appear in all copies of the
  17. * software, derivative works or modified versions, and any portions
  18. * thereof, and that both notices appear in supporting documentation.
  19. *
  20. * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
  21. * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.  
  22. * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
  23. * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  24. *
  25. * The EXODUS Project Group requests users of this software to return 
  26. * any improvements or extensions that they make to:
  27. *
  28. *   EXODUS Project Group 
  29. *     c/o David J. DeWitt and Michael J. Carey
  30. *   Computer Sciences Department
  31. *   University of Wisconsin -- Madison
  32. *   Madison, WI 53706
  33. *
  34. *    or exodus@cs.wisc.edu
  35. *
  36. * In addition, the EXODUS Project Group requests that users grant the 
  37. * Computer Sciences Department rights to redistribute these changes.
  38. **********************************************************************/
  39.  
  40. #ifndef OVPAGE_H
  41. #define OVPAGE_H
  42.  
  43.  
  44.  
  45. //
  46. //  NOTE: both lrc and selfID must be in the same position as those in
  47. //      BTREEPAGE. This is because we use BTREEPAGE as unit of allocation
  48. //      in IO level.
  49. //
  50. struct OVCONTROL {
  51.     LRC        lrc;
  52.     PID        selfID;
  53.     TWO        elCnt;
  54.     TWO        elSize;
  55.     TWO        maxEl;
  56.     TWO        dummy;
  57.     SHORTPID    next;
  58.     SHORTPID    prev;
  59.     };
  60.  
  61. const OV_DATASIZE = BTREE_PAGESIZE - sizeof(OVCONTROL);
  62.  
  63.  
  64. /*
  65. #ifdef BT_DEBUG
  66. const OV_MAXOIDCNT = (MAXTUPLESIZE - FIXEDMEM) / sizeof(OID);
  67. #else
  68. const OV_MAXOIDCNT = OV_DATASIZE / sizeof(OID);
  69. #endif
  70. */
  71.  
  72. class OVPAGE    {
  73.     
  74.     OVCONTROL   ovCtrl;
  75.     char    c[OV_DATASIZE];    // contents --- an array of elements
  76.     
  77. public:
  78.     
  79.     SHORTPID&   NextPage()    { return ovCtrl.next; }
  80.     SHORTPID&   PrevPage()    { return ovCtrl.prev; }
  81.     int            ElCnt()        { return ovCtrl.elCnt; }
  82.     int            ElSize()    { return ovCtrl.elSize; }
  83.     int            MaxEl()        { return ovCtrl.maxEl; }
  84.     
  85.     void    Init(PID& pid, int es);
  86.     
  87.     LRC&    lrc()        { return ovCtrl.lrc; }
  88.     PID&    SelfID()    { return ovCtrl.selfID; }
  89.     
  90.     void    Linkup(OVPAGE* rightPage);
  91.     void    Shift(int start, OVPAGE* destPage);
  92.     
  93.     void    Sort();
  94.     
  95.     void*    Get(int idx)    { ASSERT3(idx < MaxEl()); 
  96.                   return c + idx * ElSize();
  97.                 }
  98.     
  99.     void    FillSort(int cnt, void* array);
  100.     void    Insert(int startSlot, int cnt, const void* array);
  101.     void    Remove(int startSlot, int cnt);
  102.     
  103.     int    CheckPage();
  104. };
  105.  
  106.  
  107.  
  108.  
  109. extern "C" {
  110.     int ov_NewCluster(TID tid, int volume, BUFGROUP* bufGroup,
  111.                 int elSize, PID& rootPid, BT_Tuple& tuple);
  112.     int ov_DestroyCluster(TID tid, const PID& rootPid, BUFGROUP* bufGroup);
  113.     int ov_AddElem(TID tid, const PID& rootPid, BUFGROUP* bufGroup, 
  114.                     const void* newElem);
  115.     int ov_RemoveElem(TID tid, const PID& rootPid, BUFGROUP* bufGroup,
  116.                     const void* doomedElem);
  117.     int ov_GetElem(const PID& rootPid, BUFGROUP* bufGroup, int idx, void* ret);
  118.     int OV_AllocPage(TID tid, int volume, BUFGROUP* bufGroup, 
  119.                     int elSize, PID& retPid);
  120.     int OV_FreePage(TID tid, const PID& pid);
  121.     int OV_Search(const PID& pid, BUFGROUP* bufGroup, const void* ep, 
  122.                     PID& retPid, int& found, int& retIdx);
  123.     int OV_Check(const PID& rootPid, BUFGROUP* bufGroup);
  124.     void OV_LogPageInit(PAGEHASH* pHash, TWO elSize);
  125.     void OV_LogModifyNextLink(PID&, PAGEHASH*, LRC&, const PID& rootPid,
  126.                 SHORTPID oldNext, SHORTPID newNext,
  127.                 LSNOFFSET undoNxtLSN);
  128.     void OV_LogModifyPrevLink(PID&, PAGEHASH*, LRC&, const PID& rootPid, 
  129.                 SHORTPID oldPrev, SHORTPID newPrev,
  130.                 LSNOFFSET undoNxtLSN);
  131.     void OV_LogInsert(PID&, PAGEHASH*, LRC&, const PID& rootPid, 
  132.                 TWO elSize, TWO slotNum, 
  133.                 TWO numSlot, void* buff, 
  134.                 LSNOFFSET undoNxtLSN);
  135.     void OV_LogDelete(PID&, PAGEHASH*, LRC&, const PID& rootPid,
  136.                 TWO elSize, TWO slotNum, 
  137.                 TWO numSlot, void* buff,
  138.                 LSNOFFSET undoNxtLSN);
  139. };
  140.  
  141.  
  142.  
  143. #endif    // OVPAGE_H
  144. #endif /* _OVPAGE_H_ */
  145.